//首页相关的接口都在这个文件下统一封装
import request from "@/utils/request";

//用户选择的频道
///未登录时 默认显示的频道列表
export const loginApi = () =>
  request({
    url: "/v1_0/user/channels",
    method: "get",
    params: "",
  });

//根据用户选择的频道id 封装渲染返回文章列表
export const articlesListApi = (params) =>
  request({
    url: "/v1_0/articles",
    method: "get",
    params,
  });
//所有频道列表
export const allChannelApi = () =>
  request({
    url: "/v1_0/channels",
    method: "get",
  });
//修改后的频道列表
export const setMyChannelApi = (channels) =>
  request({
    url: "/v1_0/user/channels",
    method: "put",
    data: {
      channels,
    },
  });
//获取搜索联想词接口
export const searchSuggestionApi = (newVal) =>
  request({
    url: "/v1_0/suggestion",
    method: "get",
    params: {
      q: newVal,
    },
  });
//搜索接口
export const searchResultApi = (obj) =>
  request({
    url: "/v1_0/search",
    method: "get",
    params: obj,
  });
